package org.example.user.MqListener;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(topic = "test-topic",consumerGroup = "test-group")
public class RocketListener implements RocketMQListener {
    @Autowired
    RedisTemplate redisTemplate;
    @Override
    public void onMessage(Object o) {
        System.out.println("接受的消息:"+o);
        //删除缓存
        redisTemplate.delete("contentList"+4);
        System.out.println("删除缓存成功");
    }
}
